#!/bin/bash

read -p "please input you need create user name:" u_name
read -p "please input you need create user numbers:" u_num

for i in `seq ${u_num}`
do
	id $u_name${i} &>/dev/null
	if (( $? != 0 ));then
		useradd ${u_name}${i} 
		read -s -p "please set password for ${u_name}${i}:" u_pwd
		echo "${u_pwd}"  |passwd ${u_name}${i} --stdin &>/dev/null
		if (( $? == 0 ));then
			echo "set ${u_name}${i} is ok"
		else
			echo "the ${u_name}${i} is set password" 
		fi
		cat /etc/passwd |awk -F: '$3>=500{print $1,$3,$4,$6,$7}'
	else
		echo "user has create"
	fi
done
